<template>
  <view class="tail-page">
      <view class="list text-center">
        <view class="item grid col-3">
          <view class="item-one">
            <b class="tail-name">
              {{thail.thaliName}}
            </b>
            <span class="tail-max-money">
              可省&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b class="text-max">{{thail.maxMoney}}</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;元
            </span>
          </view>
          <view class="item-two">
            <span class="tail-math" itemprop="" v-if="thail.couponType==1">{{thail.sale}}</span>
            <span class="tail-math" itemprop="" v-if="thail.couponType==2">{{thail.saleMoney}}</span>
            <span class="tail-status" v-if="thail.couponType==1">折</span>
            <span class="tail-status" v-if="thail.couponType==2">元</span>
            <span>x</span>
            <span class="order-number">{{thail.couponNum}}</span>
            <span class="zhang">张</span>
          </view>
          <view class="item-three">
            <div class="tail-price-status">￥<b class="price">{{ thail.price }}</b></div>
            <div class="max-price">最高省<span class="tail-price-status">{{thail.maxMoney}}</span>元</div>
          </view>
        </view>
        <view class="item-co">
          <div class="in-div-one"><b class="in-one">套餐包含</b></div>
          <div class="in-div-two"><span class="in-two">
            打车红包
            <span v-if="thail.couponType==2">{{thail.saleMoney}}</span>
            <span v-if="thail.couponType==1">{{thail.sale}}</span>
            <span v-if="thail.couponType==1">折</span>
            <span v-if="thail.couponType==2">元</span>
            &nbsp;x{{thail.couponNum}}张
          </span></div>
          <div class="in-div-three"><span class="in-three">
            每单最多折扣{{thail.saleMoney/thail.couponNum}}元，限7:00-9:00&nbsp;16:00-19:00使用
          </span></div>
        </view>
        <view class="item-c">
          <div class="in-div-one"><b class="in-one">购买须知</b></div>
          <div class="in-div-three1"><span class="in-two">
            这是一段购买须知文案
          </span></div>
          <div class="in-div-three2"><span class="in-three">
            {{thail.thaliNotice}}
          </span></div>
        </view>
        <view class="button-pay">
          <button class="topay" @click="goToPay()"><b>{{thail.price}}&nbsp;元购买</b></button>
        </view>
      </view>

  </view>
</template>
<script>

import { getThailOne } from '@/api/durian/thail/thail.js'
import { buyThailOne } from '@/api/durian/thail/thail.js'

export default {
  data() {
    return {
      id: '',
      thail:{}
    };
  },
  onLoad: function(res) {
    this.id = res.id
    this.getThail();
  },
  methods: {
    getThail() {
      getThailOne(this.id).then(res=>{
        this.thail=res.data;
      })
    },
    goToPay(){
      buyThailOne(this.id).then(res=>{
        this.$tab.reLaunch('/pages/mine/tail/index');
      })
    }

  }


}
</script>

<style>
.text-max{
  color: red;
  font-size: 20px;
}
.tail-max-money{
  display: block;
  margin-top: 35px;
}
.tail-name{
  font-size: 17px;
  color: #c22c2d;
  display: block;
  margin-top: 5px;
}
.topay{
  display: flex;
  width: 320px;
  height: 40px;
  margin-top: 7px;
  border-radius: 30px;
  text-align: center;
  justify-content: center;
  align-items: center;
  color: white;
  background-color: #f07947;
}
.button-pay{
  width: 375px;
  position: fixed;
  bottom: 0;
  height: 55px;
  background-color: white;
}
.in-one{
  font-size: 20px;
}
.in-div-one{
  display: flex;
  width: 100px;
  padding-top: 10px;
  margin-left: 20px;
}
.in-div-two{
  display: flex;
  width: 200px;
  padding-top: 5px;
  margin-left: 20px;
}
.in-div-three{
  width: 500px;
  display: flex;
  padding-top: 10px;
  margin-left: 20px;
  color: #8f939c;
}
.in-div-three1{
  width: 500px;
  display: flex;
  margin-top: 20px;
  padding-top: 10px;
  margin-left: 20px;
  color: #8f939c;
}
.in-div-three2{
  width: 500px;
  display: flex;
  margin-top: 20px;
  padding-top: 10px;
  margin-left: 20px;
  color: #8f939c;
}

.item-c {
  width: 360px;
  height: 40vh;
  background-color: white;
  margin-top: 10px;
  border-radius: 20px;
  margin-left: auto;
  margin-right: auto;
}
.item-co {
  width: 360px;
  height: 16vh;
  background-color: white;
  margin-top: 10px;
  border-radius: 20px;
  margin-left: auto;
  margin-right: auto;
}
.item {
  display: flex;
  width: 360px;
  height: 20vh;
  background-color: white;
  margin-top: 10px;
  border-radius: 20px;
  margin-left: auto;
  margin-right: auto;
}
.item-one{
  background-image: url("/static/images/yhqbeijing.png");
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  height: 12vh;
  margin-top: 15px;
  margin-bottom: auto;
  margin-left: auto;
  margin-right: auto;
  padding-top: 5px;
}
.item-two{
  background-color: #f9f5f0;
  display: flex;
  align-items: center;
  justify-content: center;
  //position: relative;
  //top: 10%;
  //left: 50%;;
  height: 60px;
  border-radius: 10px;
  margin-top: auto;
  margin-bottom: auto;
  margin-left: auto;
  margin-right: auto;
  padding-top: 5px;
}
.tail-math{
  font-size: 20px;
}
.tail-status{
  font-size: 13px;
  margin-right: 5px;
}
.order-number{
  font-size: 20px;
  margin-left: 5px;
}
.item-three{
  height: 15vh;
  margin-top: 40px;
  margin-bottom: auto;
  margin-left: auto;
  margin-right: auto;
  padding-top: 5px;
}
.tail-price-status{
  color: red;
}
.price{
  font-size: 22px;
}
.max-price{
  font-size: 10px;
  margin-top: 10px;
}
.pay-button{
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  width: 70px;
  height: 25px;
  background-color: #f9f5f0;
  color: white;
  border-radius: 30px;
  font-size: 12px;
}
</style>